﻿Global.namespace("System.Core.Handler");
System.Core.Handler.UrlHandler={};
// return path to template file
System.Core.Handler.UrlHandler.getTemplateFileUrl=function(templateFile){
    var time=new Date();
    var url= StringHandler.format("{0}{1}{2}{3}",Config.htmlTemplateUrl,templateFile,templateFile.indexOf('?')>=0?"&t=":"?t=", time.getMilliseconds());
    return url;
}
// encode url
System.Core.Handler.UrlHandler.urlEncode = function(url){
    var o=url;
    if(!o){
        return "";
    }
    var buf = [];
    for(var key in o){
        var ov = o[key], k = encodeURIComponent(key);
        var type = typeof ov;
        if(type == 'undefined'){
            buf.push(k, "=&");
        }else if(type != "function" && type != "object"){
            buf.push(k, "=", encodeURIComponent(ov), "&");
        }else if(Ext.isArray(ov)){
            if (ov.length) {
                for(var i = 0, len = ov.length; i < len; i++) {
                    buf.push(k, "=", encodeURIComponent(ov[i] === undefined ? '' : ov[i]), "&");
                }
            } else {
                buf.push(k, "=&");
            }
        }
    }
    buf.pop();
    return buf.join("");
}
var UrlHandler=System.Core.Handler.UrlHandler;